package com.wthink.newMain.newBusiness.inner.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.wthink.hzgj.Constants
import com.wthink.hzgj.util.PreferencesUtils
import com.wthink.newMain.newBusiness.data.BusinessData

class NewBusinessHistoryViewmodel : ViewModel(){

    val hostoryList = MutableLiveData(emptyList<BusinessData>())


    fun start(){
        val stringObject = PreferencesUtils.getStringObject(Constants.BUSINESS_LIST)
        val listType =
            object : TypeToken<List<BusinessData?>?>() {}.type
        val list: List<BusinessData> = Gson().fromJson(stringObject, listType)

        hostoryList.postValue(list)

    }

}